import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import viewsindex from '@/views/views-index'

//使用懒加载的方式来引入,只有路由被访问的时候才加载
import home from '@/components/home'

const loginpage = resolve => require(['@/components/Login'], resolve)


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/hello',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/',
      name: 'login',
      component: loginpage
    },
    {
      path: '/login',
      name: 'login',
      component: loginpage
    },
    {
      path: '/home',
      name: 'home',
      component: home
    },
    {
      path: '/viewsindex',
      name: 'viewsindex',
      component :viewsindex
    }
  ]
})
